<!DOCTYPE HTML>
<html  xmlns:th="http://www.thymeleaf.org">
<head th:include="_meta :: header">
<title>添加</title>
</head>
<body>
<div class="layui-fluid">
    <div class="layui-row">
        <form class="layui-form form form-horizontal"  id="form-audio-add" action="#" th:action="@{/admin/audio/add}">
            <div class="layui-form-item">
                <label class="layui-form-label"><span class="x-red">*</span>稿件id：</label>
                        <div class="layui-input-inline">
                        <input type="layui-input" class="layui-input" t name="draftId"  placeholder="修改稿件id" id="draftId"/>
                        </div>
                        </div>
            <div class="layui-form-item">
                <label class="layui-form-label"><span class="x-red">*</span>音频地址：</label>
                        <div class="layui-input-inline">
                        <input type="layui-input" class="layui-input" t name="audioUrl"  placeholder="修改音频地址" id="audioUrl"/>
                        </div>
                        </div>
            <div class="layui-form-item">
                <label class="layui-form-label"><span class="x-red">*</span>提交时间：</label>
                <div class="layui-input-inline">
                    <input type="layui-input" class="layui-input timeSpace" readonly="readonly"
                           autocomplete="off" name="submitTime" placeholder="请选择提交时间"/>
                </div>
                        </div>
            <div class="layui-form-item">
                <label class="layui-form-label"><span class="x-red">*</span>音频制作人：</label>
                        <div class="layui-input-inline">
                        <input type="layui-input" class="layui-input" t name="audioPerple"  placeholder="修改音频制作人" id="audioPerple"/>
                        </div>
                        </div>
            <div class="layui-form-item">
                <label class="layui-form-label"><span class="x-red">*</span>音频时长：</label>
                        <div class="layui-input-inline">
                        <input type="layui-input" class="layui-input" t name="audioLength"  placeholder="修改音频时长" id="audioLength"/>
                        </div>
                        </div>
            <div class="layui-form-item">
                <label class="layui-form-label"><span class="x-red">*</span>状态code：</label>
                        <div class="layui-input-inline">
                        <input type="layui-input" class="layui-input" t name="statusCode"  placeholder="修改状态code" id="statusCode"/>
                        </div>
                        </div>
            <div class="layui-form-item">
                <label class="layui-form-label"><span class="x-red">*</span>是否删除(0是1否)：</label>
                        <div class="layui-input-inline">
                        <input type="layui-input" class="layui-input" t name="isDelete"  placeholder="修改是否删除(0是1否)" id="isDelete"/>
                        </div>
                        </div>
            <div class="layui-form-item">
                <label class="layui-form-label"><span class="x-red">*</span>创建时间：</label>
                <div class="layui-input-inline">
                    <input type="layui-input" class="layui-input timeSpace" readonly="readonly"
                           autocomplete="off" name="createTime" placeholder="请选择创建时间"/>
                </div>
                        </div>
            <div class="layui-form-item">
                <label class="layui-form-label"><span class="x-red">*</span>修改时间：</label>
                <div class="layui-input-inline">
                    <input type="layui-input" class="layui-input timeSpace" readonly="readonly"
                           autocomplete="off" name="updateTime" placeholder="请选择修改时间"/>
                </div>
                        </div>
            
            <div class="layui-form-item">
                <label class="layui-form-label">
                </label>
                <button  class="layui-btn" id="subbtn" type="submit" >
                    增加
                </button>
                <button  class="layui-btn" id="reset" type="reset" >
                    重置
                </button>
            </div>
        </form>
    </div>
</div>

<!--_footer 作为公共模版分离出去-->
<div th:replace="_footer :: footerjs"></div>
<div th:replace="_ueditor :: ueditor"></div>
 <!--/_footer 作为公共模版分离出去-->
<!--请在下方写此页面业务相关的脚本-->
<script>
    layui.use(['form', 'layer','laydate'],function() {
        $ = layui.jquery;
        var form = layui.form,
            laydate = layui.laydate,
            layer = layui.layer;
        lay('.timeSpace').each(function(){
            laydate.render({
                elem: this
                ,trigger: 'click'
                ,type: 'datetime'
            });
        });
    });
 $(function(){
	$("#form-audio-add").validate({
		rules:{
            draftId:{
                required: true,
			},
            audioUrl:{
                required: true,
			},
            submitTime:{
                required: true,
			},
            audioPerple:{
                required: true,
			},
            audioLength:{
                required: true,
			},
            statusCode:{
                required: true,
			},
            isDelete:{
                required: true,
			},
            createTime:{
                required: true,
			},
            updateTime:{
                required: true,
			},
		},
		onkeyup:false,
		debug: true,
		success:"valid",
		submitHandler:function(form){
				$(form).ajaxSubmit({
				type: 'POST',
				url: "/admin/audio/add" ,
				success: function(data){
					if(data.code == "1"){
						selfmsg('添加成功!',1,function(){
							var index = parent.layer.getFrameIndex(window.name);
							parent.location.reload();
							parent.layer.close(index);
						});
					}else{
						selfmsg('添加失败!');
					}
				},
                error: function(){
					selfmsg('添加异常!',5);
				}
			});
		}
	});
});

</script>
<!--/请在上方写此页面业务相关的脚本-->
</body>
</html>